/******************************************************************
 * Title: unscrun.sc
 * Author:  Brian Peck
 * Date: Spring 2011
 * Description: Specification model for unscrun (in DES)
 *****************************************************************/
import "i_receiver";
import "i_sender";

behavior unscrun(i_reciever ir, i_sender is)
{
  void main(void) {
    unsigned char * outof;
    unsigned long * into;
    while (1) {
      ir.receive(&outof, sizeof(outof));
	*into++ = (*outof >> 24) & 0xffL;
	*into++ = (*outof >> 16) & 0xffL;
	*into++ = (*outof >>  8) & 0xffL;
	*into++ =  *outof++	 & 0xffL;
	*into++ = (*outof >> 24) & 0xffL;
	*into++ = (*outof >> 16) & 0xffL;
	*into++ = (*outof >>  8) & 0xffL;
	*into	=  *outof	 & 0xffL;
      ir.send(&into, sizeof(into));
    }
  } // end main
} // end behavior unscrun
